package com.ym521.simple

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.addTextChangedListener
import com.ym521.emojipack.EmojiPackHelper
import com.ym521.emojipack.EmojiPackKeyBoard
import com.ym521.simple.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

    private lateinit var viewBind: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        EmojiPackHelper.activity(this).install()
        super.onCreate(savedInstanceState)
        viewBind = ActivityMainBinding.inflate(layoutInflater)
        setContentView(viewBind.root)
        val emoji: EmojiPackKeyBoard.Builder= EmojiPackKeyBoard.build(this,EmojiPackKeyBoard.THEME_SIMPLE)
            .setInputView(viewBind.etIput)
            .bindView(viewBind.flEmoji)
        viewBind.tvEmoji.setOnClickListener {
            it.isSelected = !it.isSelected
            if (it.isSelected) {
                emoji.show()
            } else {
                emoji.hide()
            }
        }
    }
}